import 'package:flutter/material.dart';

class OptionsBase {
  // 全局p配置值
  final double _padding = 8.0;
  final double _radio = 5.0;
  final double titleSize = 18;
  final double tagSize = 15;
  final int refreshTime = 500;

  OptionsBase();

  double get padding => _padding;
  double get radio => _radio;

  // 计算图片列表的列数
  int imageColumns(BuildContext context) {
    double width = MediaQuery.of(context).size.width;
    int col;

    if (width >= 1200) {
      col = 6;
    } else if (width >= 1000) {
      col = 5;
    } else if (width >= 800) {
      col = 4;
    } else if (width >= 700) {
      col = 3;
    } else {
      col = 2;
    }

    return col;
  }

  // 计算分类列表的列数
  int typeColumns(BuildContext context) {
    double width = MediaQuery.of(context).size.width;
    int col;

    if (width >= 1200) {
      col = 6;
    } else if (width >= 1000) {
      col = 5;
    } else if (width >= 800) {
      col = 4;
    } else {
      col = 3;
    }

    return col;
  }
}
